import React from "react";
import Tabs from "./index";

export default ({ menu, handleMenuClick, history }) => {
  const items = menu.children.map((item) => {
    return {
      key: item.id,
      tab: item.title,
    };
  });
  const handleChange = (activeKey) => {
    handleMenuClick(menu.id, activeKey);
    const { path } = menu.children.find((item) => item.id == activeKey);
    history.push(path);
  };
  return (
    <div>
      <Tabs items={items} activeKey={menu.active} onChange={handleChange} />
      <div id="container" />
    </div>
  );
};
